from ext import db


class Good(db.Model):
    """用户表"""
    __tablename__ = 'good'  # 创建后表名 小写

    id = db.Column(db.Integer, primary_key=True, comment='id主键')  # 必须要有
    name = db.Column(db.String(32), unique=True, comment='用户名')

    def __repr__(self):  # 查询的返回 和str一样
        return f'<{self.__class__.__name__} {self.username}>'


class GoodInfo(db.Model):
    """商品详情表"""
    __tablename__ = "good_info"
    id = db.Column(db.Integer, primary_key=True, comment='id主键')  # 必须要有
    price = db.Column(db.String(64), nullable=False, comment='密码')
    decrible = db.Column(db.String(32), unique=True, comment='用户名')
    commt = db.Column(db.String(64), nullable=False, comment='密码')
